//
//  ShopOrderInfoTableViewController.m
//  GoodWayClient
//
//  Created by HuiDong on 15/12/9.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "ShopOrderInfoTableViewController.h"
#import "DropDown1.h"
#import "GoodInfoTableViewCell.h"
#import "OrdercommentsTableViewCell.h"
#import "OrderMoneyTableViewCell.h"
#import "SubmitPay.h"
#import "DropDown1.h"
#import "SubmitPay.h"

@interface ShopOrderInfoTableViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *myTableView;

@property (nonatomic, strong)NSDictionary *dic;
@property (nonatomic, strong)NSDictionary *dic1;
@property (nonatomic, strong)NSDictionary *dic2;

@end

@implementation ShopOrderInfoTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //提交订单按钮
    self.myTableView.tableFooterView = [SubmitPay footView];
    
    //请选择收货地址
    DropDown1 *dd1 = [[DropDown1 alloc] initWithFrame:CGRectMake(0,[[UIScreen mainScreen] bounds].size.width*0.2, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height*0.05)];
    dd1.textField.placeholder = @"请选择收货地址";
    NSArray* arr=[[NSArray alloc]initWithObjects:@"河北省",@"山西省",@"辽宁省",@"吉林省",@"黑龙江省",@"江苏省",@"浙江省",@"安徽省",@"福建省",@"江西省",@"山东省",@"河南省",@"湖北省",@"湖南省",@"广东省",@"海南省",@"四川省",@"贵州省",@"云南省",@"陕西省",@"甘肃省",@"青海省",@"台湾省",@"内蒙古自治区",@"广西壮族自治区",@"西藏自治区",@"宁夏回族自治区",@"新疆维吾尔自治区",@"香港特别行政区",@"澳门特别行政区",nil];
    dd1.tableArray = arr;
    [self.view addSubview:dd1];
    
    //时间不限
    DropDown1 *dd2 = [[DropDown1 alloc] initWithFrame:CGRectMake(0,[[UIScreen mainScreen] bounds].size.width*0.3, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height*0.05)];
    dd2.textField.placeholder = @"时间不限";
    NSArray* arr2=[[NSArray alloc]initWithObjects:@"河北省",@"山西省",@"辽宁省",@"吉林省",@"黑龙江省",@"江苏省",@"浙江省",@"安徽省",@"福建省",@"江西省",@"山东省",@"河南省",@"湖北省",@"湖南省",@"广东省",@"海南省",@"四川省",@"贵州省",@"云南省",@"陕西省",@"甘肃省",@"青海省",@"台湾省",@"内蒙古自治区",@"广西壮族自治区",@"西藏自治区",@"宁夏回族自治区",@"新疆维吾尔自治区",@"香港特别行政区",@"澳门特别行政区",nil];
    dd2.tableArray = arr2;
    [self.view addSubview:dd2];
    
    //请选择配送方式
    DropDown1 *dd3 = [[DropDown1 alloc] initWithFrame:CGRectMake(0,[[UIScreen mainScreen] bounds].size.width*0.4, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height*0.05)];
    dd3.textField.placeholder = @"请选择配送方式";
    NSArray* arr3=[[NSArray alloc]initWithObjects:@"河北省",@"山西省",@"辽宁省",@"吉林省",@"黑龙江省",@"江苏省",@"浙江省",@"安徽省",@"福建省",@"江西省",@"山东省",@"河南省",@"湖北省",@"湖南省",@"广东省",@"海南省",@"四川省",@"贵州省",@"云南省",@"陕西省",@"甘肃省",@"青海省",@"台湾省",@"内蒙古自治区",@"广西壮族自治区",@"西藏自治区",@"宁夏回族自治区",@"新疆维吾尔自治区",@"香港特别行政区",@"澳门特别行政区",nil];
    dd3.tableArray = arr3;
    [self.view addSubview:dd3];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

//懒加载
- (NSDictionary *)dic
{
    if (!_dic) {
        _dic = @{@"image":@"logo",@"discri":@"描述详细的商品信息!",@"money":@"200积分+90元",@"amount":@"X1",@"number":@"共1件"};
    }
    return _dic;
}
- (NSDictionary *)dic1
{
    if (!_dic1) {
        _dic1 = @{@"1":@"$290.00",@"2":@"$200.00",@"3":@"$0.00",@"4":@"$90.00"};
    }
    return _dic1;
}
- (NSDictionary *)dic2
{
    if (!_dic2) {
        _dic2 = @{@"comment":@"(选填)"};
    }
    return _dic2;
}

//数据源方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 3;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   if (indexPath.row == 0)
    {
        GoodInfoTableViewCell *cell = [GoodInfoTableViewCell GoodInfoWithTableView:tableView];
        cell.dic = self.dic;
        return cell;
    }else  if (indexPath.row == 1)
    {
        OrdercommentsTableViewCell *cell = [OrdercommentsTableViewCell OrdercommentsWithTableView:tableView];
        cell.dic = self.dic2;
        return cell;
    }
        else
    {
        OrderMoneyTableViewCell *cell = [OrderMoneyTableViewCell OrderMoneyWithTableView:tableView];
        cell.dic = self.dic1;
        return  cell;
    }
}

//设置行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return 120;
    }else if(indexPath.row == 1)
    {
        return 120;
    }else
    {
        return 150;
    }
}

//隐藏工具栏
-(BOOL)prefersStatusBarHidden
{
    return YES;
}


@end
